package com.braveman.im.ui.activity;

import android.graphics.Color;
import android.view.View;
import android.widget.RadioButton;
import android.widget.TextView;
import android.widget.Toast;

import com.braveman.im.R;
import com.braveman.im.utils.UtilsStyle;
import com.ht.baselibs.ui.base.BaseActivity;
import com.ht.baselibs.utils.ActivityUtils;
import com.recker.flybanner.FlyBanner;
import com.vondear.rxtools.RxBarTool;

import java.util.ArrayList;
import java.util.List;

/**
 * Created by 昊昊 on 2017/10/13.
 */

/**
 * 会员
 */
public class MemberActivity extends BaseActivity {

    private FlyBanner mBannerLocal; //加载本地图片
    private FlyBanner mBannerNet;//加载网络图片
    private RadioButton button1;//个人会员
    private RadioButton button2;//企业会员
    private TextView money1;
    private TextView money2;
    private TextView money3;
    private RadioButton title1;
    private RadioButton title2;
    private String[] mImagesUrl = {""};

    @Override
    protected boolean isStaticPage() {
        return true;
    }

    @Override
    protected void initTitleBar() {
        mTitleBarView.setTitleText("会员").setLeftBtnIcon(R.mipmap.back_black).setOnLeftBtnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                ActivityUtils.finishActivity(MemberActivity.this);
            }
        });
    }

    @Override
    protected int initContentView() {
        UtilsStyle.setStatusBarMode(this, true);
        RxBarTool.FlymeSetStatusBarLightMode(getWindow(), true);
        RxBarTool.MIUISetStatusBarLightMode(getWindow(), true);
        return R.layout.activity_member;
    }

    @Override
    public void onClick(View v) {
        super.onClick(v);
        switch (v.getId()) {
            case R.id.activity_member1://个人会员
                money1.setText("银卡");
                money2.setText("金卡");
                money3.setText("铂金卡");
                title1.setTextColor(Color.RED);
                title2.setTextColor(Color.BLACK);
                break;
            case R.id.activity_member2://企业会员
                money1.setText("5000元/年");
                money2.setText("10000元/年");
                money3.setText("15000元/年");
                title1.setTextColor(Color.BLACK);
                title2.setTextColor(Color.RED);
                break;
        }
    }

    @Override
    protected void initChildView() {
        mBannerLocal = (FlyBanner) findViewById(R.id.banner1);
        mBannerNet = (FlyBanner) findViewById(R.id.banner1);
        button1 = (RadioButton) findViewById(R.id.activity_member1);
        button2 = (RadioButton) findViewById(R.id.activity_member2);
        money1 = (TextView) findViewById(R.id.money1);
        money2 = (TextView) findViewById(R.id.money2);
        money3 = (TextView) findViewById(R.id.money3);
        title1 = findViewById(R.id.activity_member1);
        title2 = findViewById(R.id.activity_member2);
        button1.setOnClickListener(this);
        button2.setOnClickListener(this);
        money1.setOnClickListener(this);
        money2.setOnClickListener(this);
        money3.setOnClickListener(this);
        title1.setOnClickListener(this);
        title2.setOnClickListener(this);
        initlocalBanner();
        // initNetBanner();
    }


    //加载本地图片
    private void initlocalBanner() {
        List<Integer> imgs = new ArrayList<>();
        imgs.add(R.mipmap.home_tab4_icon_press);
        imgs.add(R.mipmap.cb_choose);
        imgs.add(R.mipmap.back);
        imgs.add(R.mipmap.check_box_select);
        mBannerLocal.setImages(imgs);
        mBannerLocal.setOnItemClickListener(new FlyBanner.OnItemClickListener() {
            @Override
            public void onItemClick(int position) {
                Toast.makeText(MemberActivity.this, "点击了第" + (position + 1) + "张图片", Toast.LENGTH_SHORT).show();
            }
        });
        mBannerLocal.setPoinstPosition(FlyBanner.RIGHT);//设置指示器的位置（左中右）
    }

//    /**
//     * 加载网页图片
//     */
//    private void initNetBanner() {
//
//
//        List<String> imgesUrl = new ArrayList<>();
//        for (int i = 0; i < mImagesUrl.length; i++) {
//            imgesUrl.add(mImagesUrl[i]);
//        }
//        mBannerNet.setImagesUrl(imgesUrl);
//
//        mBannerNet.setOnItemClickListener(new FlyBanner.OnItemClickListener() {
//            @Override
//            public void onItemClick(int position) {
//                Toast.makeText(MemberActivity.this, "点击了第" + (position + 1) + "张图片", Toast.LENGTH_SHORT).show();
//            }
//        });
//    }

    @Override
    protected void initChildData() {

    }

    @Override
    protected void setChildViewListener() {

    }
}
